
package org.apache.osgimaker.analyse.algorithm.dependency;

import java.util.HashMap;

import org.apache.osgimaker.analyse.algorithm.util.StringPattern;


class LayerDefinitionRepository
{
  private final HashMap _nameToLayerMap = new HashMap();
  private final HashMap _layerToNameMap = new HashMap();
  
  public int getNumberOfDefinitions() 
  {
    return _nameToLayerMap.size();
  }
  
  public void put(String name, StringPattern[] layer)
  {
    _nameToLayerMap.put(name, layer);
    _layerToNameMap.put(layer, name);
  }
  
  public StringPattern[] getLayer(String name)
  {
    return (StringPattern[]) _nameToLayerMap.get(name);
  }
  
  public boolean contains(String name)
  {
    return _nameToLayerMap.containsKey(name);
  }
  
  public String getName(StringPattern[] layer)
  {
    return (String) _layerToNameMap.get(layer);
  }
  
}
